<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
           任务队列，事件轮询loop
        */

      new Promise((resolve) => {
        console.log(5);
        setTimeout(() => {
          resolve();
          console.log(4);
        }, 100);
      }).then(() => {
        console.log(1);
        setTimeout(() => {
          console.log(2);
        }, 2000);
      });
      console.log(3);
    </script>
  </body>
</html>
